// 定义类
class Person {
  late String name;
  late int age;


// 默认构造函数，相当于 js constructor
//   Person(String name, int age) {
//     this.name = name;
//     this.age = age;
//   }
// 默认构造函数的简写
  Person(this.name, this.age);

  void getUserInfo() {
    print("${this.name}---${this.age} ");
  }
}

void main() {
  // 实例化类
  Person p1 = new Person('张三', 30);
  p1.getUserInfo();
  print(p1.name);

  Person p2 = new Person('李四', 40);
  p2.getUserInfo();
  print(p2.name);
}
